﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TransCode.Entitys;

namespace TransCode.Player.VideoPage
{
    /// <summary>
    /// Interaction logic for TargetListControl.xaml
    /// </summary>
    public partial class TargetListControl : UserControl
    {
        public TargetListControl()
        {
            InitializeComponent();
        }

        public void SetVideoSource(Video video, IVideoPlayer ivideoPlayer)
        {
            layout.Children.Clear();

            foreach (var target in video.TargetList)
            {
                TargetItemControl ti = new TargetItemControl();
                ti.Target = target;
                ti.Video = video;
                ti.VideoPlayer = ivideoPlayer;
                layout.Children.Add(ti);

            }
        }

        private void ScrollViewer_MouseEnter(object sender, MouseEventArgs e)
        {
            ScrollViewer sv = sender as ScrollViewer;
            sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
        }

        private void ScrollViewer_MouseLeave(object sender, MouseEventArgs e)
        {
            ScrollViewer sv = sender as ScrollViewer;
            sv.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
        }
    }
}
